home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / advcrt90.zip / ADVCRT.DOC < prev    next >
Text File  |  1993-01-04  |  42KB  |  527 lines

  1. (*****************************************************************************
  2.  *                                                                           *
  3.  *  ADVCRT - Advanced Screen and Keyboard Manipulation Routines              *
  4.  *           for Borland International's Turbo Pascal Version 5.5            *
  5.  *                                                                           *
  6.  *    Serial Number:  000000 - Released June 19, 1990                        *
  7.  *      Licensed to:  Author                                                 *
  8.  *              For:  Normal use                                             *
  9.  *  Current Version:  9.0                                                    *
  10.  *                                                                           *
  11.  *****************************************************************************
  12.  *                                                                           *
  13.  *                      Description of AdvCRT Routines:                      *
  14.  *                                                                           *
  15.  *****************************************************************************
  16.  *                                                                           *
  17.  *  Procedure FindScreenBase(var ScreenBase: Word);                          *
  18.  *  {                                                                        *
  19.  *   DESCRIPTION:                                                            *
  20.  *        Returns type of display adaptor installed in the form of the       *
  21.  *        Video Segment Address.                                             *
  22.  *   PARAMETERS:                                                             *
  23.  *        ScreenBase (out) - Video Segment Address of display                *
  24.  *          Hex B800 - SVGA/VGA/EGA/CGA/MCGA card                            *
  25.  *          Hex B000 - Monochrome card                                       *
  26.  *   NOTE(S):                                                                *
  27.  *        Used primarily for DirectOut procedure.                            *
  28.  *  ----------------------------------------------------------------------}  *
  29.  *                                                                           *
  30.  *  Function QuickScreenBase: Word;                                          *
  31.  *  {                                                                        *
  32.  *   DESCRIPTION:                                                            *
  33.  *        Returns the Video Segment Address of the current video             *
  34.  *        display adaptor installed.  Used instead of a global variable      *
  35.  *        and the FindScreenBase procedure.                                  *
  36.  *  ----------------------------------------------------------------------}  *
  37.  *                                                                           *
  38.  *  Function MakeAttr(Fore, Back: Byte): Byte;                               *
  39.  *  {                                                                        *
  40.  *   DESCRIPTION:                                                            *
  41.  *        Converts given Foreground and Background colors into a             *
  42.  *        single Attribute byte for low level machine calls.                 *
  43.  *   PARAMETERS:                                                             *
  44.  *        Fore (in) - Foreground of Attribute to make                        *
  45.  *        Back (in) - Background of Attribute to make                        *
  46.  *   NOTE(S):                                                                *
  47.  *        Opposite of ExtractAttr procedure.                                 *
  48.  *  ----------------------------------------------------------------------}  *
  49.  *                                                                           *
  50.  *  Procedure ExtractAttr(Attr: Byte; var Fore, Back: Byte);                 *
  51.  *  {                                                                        *
  52.  *   DESCRIPTION:                                                            *
  53.  *        Converts machine Attribute (single number) to Compiler             *
  54.  *        specific Foreground and Background colors.                         *
  55.  *   PARAMETERS:                                                             *
  56.  *        Attr  (in) - Attribute byte used in low level machine calls        *
  57.  *        Fore (out) - Foreground color extracted from Attr                  *
  58.  *        Back (out) - Background color extracted from Attr                  *
  59.  *   NOTE(S):                                                                *
  60.  *        Opposite of MakeAttr function.                                     *
  61.  *  ----------------------------------------------------------------------}  *
  62.  *                                                                           *
  63.  *  Procedure TurnCursor(ONorOFF: Boolean);                                  *
  64.  *  {                                                                        *
  65.  *   DESCRIPTION:                                                            *
  66.  *        Turns the cursor ON or OFF.  That is, makes it visible or          *
  67.  *        invisble.  Current cursor shape is retained in the global          *
  68.  *        variable SaveCursor.                                               *
  69.  *   PARAMETERS:                                                             *
  70.  *        ONorOFF (in) - Pass in ON to make cursor visible, OFF to hide      *
  71.  *                       cursor                                              *
  72.  *   SYNTAX:                                                                 *
  73.  *        1.  TurnCursor(OFF); - Hide Cursor                                 *
  74.  *        2.  TurnCursor(ON);  - Reveal Cursor                               *
  75.  *  ----------------------------------------------------------------------}  *
  76.  *                                                                           *
  77.  *  Procedure SetCursor(StartScan, EndScan: Byte);                           *
  78.  *  {                                                                        *
  79.  *   DESCRIPTION:                                                            *
  80.  *        Sets cursor to a specific size.                                    *
  81.  *   PARAMETERS:                                                             *
  82.  *        StartScan (in) - Start cursor scan line (upper half)   (0-13)      *
  83.  *        EndScan   (in) - Ending cursor scan line (bottom half) (0-13)      *
  84.  *   NOTE(S):                                                                *
  85.  *        If StartScan>EndScan the cursor will become invisible.             *
  86.  *  ----------------------------------------------------------------------}  *
  87.  *                                                                           *
  88.  *  Procedure Scroll(X1,Y1,X2,Y2, LinesToScroll, BlankLineAttr,              *
  89.  *                   UPorDOWN: Byte);                                        *
  90.  *  {                                                                        *
  91.  *   DESCRIPTION:                                                            *
  92.  *        Scrolls a particular area of the screen up or down.                *
  93.  *   PARAMETERS:                                                             *
  94.  *        X1, Y1        (in) - Coord. of upper-left area to be scrolled      *
  95.  *        X2, Y2        (in) - Coord. of lower-right area to be scrolled     *
  96.  *        LinesToScroll (in) - Number of lines to scroll                     *
  97.  *        BlankLineAttr (in) - Attribute to fill the blank area with         *
  98.  *        UpOrDown      (in) - Direction to scroll the area - 0=Up, 1=Down   *
  99.  *   NOTE(S):                                                                *
  100.  *        (X1,Y1), (X2,Y2) are related to the coordinates given for          *
  101.  *        Turbo Pascal's standard Window procedure.                          *
  102.  *  ----------------------------------------------------------------------}  *
  103.  *                                                                           *
  104.  *  Procedure TurnScreen(ONorOFF: Boolean);                                  *
  105.  *  {                                                                        *
  106.  *   DESCRIPTION:                                                            *
  107.  *        Turns the display ON or OFF software wise.  If OFF, all output     *
  108.  *        to the screen is written, but not shown.  Clearing the screen      *
  109.  *        along with a TurnScreen(ON) will reactivate the display.           *
  110.  *   SYNTAX:                                                                 *
  111.  *        1.  TurnScreen(OFF); - Turn Screen OFF--Software Wise              *
  112.  *        2.  TurnScreen(ON);  - Turn Screen ON                              *
  113.  *   NOTE(S):                                                                *
  114.  *        Note that a DIRECT screen write while the screen is OFF will       *
  115.  *        infact show up on the display.  If you wish to write to the        *
  116.  *        screen while it is "OFF", use Turbo's WRITE and WRITELN.           *
  117.  *  ----------------------------------------------------------------------}  *
  118.  *                                                                           *
  119.  *  Procedure DirectOut(X,Y: Byte; aStr: String; Attr: Byte);                *
  120.  *  {                                                                        *
  121.  *   DESCRIPTION:                                                            *
  122.  *        Writes a string of information directly to video display memory.   *
  123.  *        This routine is not the fastest possible, since it actually        *
  124.  *        outputs a character at a time.                                     *
  125.  *   PARAMETERS:                                                             *
  126.  *        X, Y (in) - Coordinates where string should be displayed           *
  127.  *        aStr (in) - String to be displayed on screen                       *
  128.  *        Attr (in) - Attribute to be used when displaying                   *
  129.  *   NOTE(S):                                                                *
  130.  *        See MakeAttr function for information on procedure that need       *
  131.  *        machine level attributes.                                          *
  132.  *  ----------------------------------------------------------------------}  *
  133.  *                                                                           *
  134.  *  Procedure SetBorder(BordColor: Byte);                                    *
  135.  *  {                                                                        *
  136.  *   DESCRIPTION:                                                            *
  137.  *        Sets screen border color.  Works on all classes of PC's            *
  138.  *        including PCjr.                                                    *
  139.  *   PARAMETERS:                                                             *
  140.  *        BorderColor (in) - Color to set the screen's border to             *
  141.  *   NOTE(S):                                                                *
  142.  *        Can also be achieved on a PC with a simple Port call. This         *
  143.  *        routine works on all PC's including PCjr.                          *
  144.  *  ----------------------------------------------------------------------}  *
  145.  *                                                                           *
  146.  *  Procedure GetCursorPos(var X,Y: Byte; Page: Byte);                       *
  147.  *  {                                                                        *
  148.  *   DESCRIPTION:                                                            *
  149.  *        Returns the position of the cursor on the screen on a given        *
  150.  *        Video Display Page.                                                *
  151.  *   PARAMETERS:                                                             *
  152.  *        X, Y (out) - Returns the coordinates of the cursor                 *
  153.  *        Page  (in) - The display page to scan for the cursor position      *
  154.  *   NOTE(S):                                                                *
  155.  *        Quite similar to WhereX and WhereY, but can be used on any         *
  156.  *        given display page.  Makes AdvCRT Unit dependant only on           *
  157.  *        the DOS Unit.                                                      *
  158.  *  ----------------------------------------------------------------------}  *
  159.  *                                                                           *
  160.  *  Procedure GetCRTMode(var Mode, Columns, ActivePage: Byte);               *
  161.  *  {                                                                        *
  162.  *   DESCRIPTION:                                                            *
  163.  *        Returns the current mode of the video display adaptor.             *
  164.  *   PARAMETERS:                                                             *
  165.  *        Mode (out) - Current mode of the CRT                               *
  166.  *          0 - 40 column B&W text mode                                      *
  167.  *          1 - 40 column color text mode                                    *
  168.  *          2 - 80 column B&W text mode                                      *
  169.  *          3 - 80 column 16 color text mode                                 *
  170.  *          4 - 4 color med-resolution graphics mode                         *
  171.  *          5 - 4 grey color med-resolution graphics mode                    *
  172.  *          6 - 2 color B&W high-resolution graphics mode                    *
  173.  *          7 - 80 column monochrome mode                                    *
  174.  *          8 - 15 graphics modes for EGA Card                               *
  175.  *        Columns    (out) - Current number of columns on the screen         *
  176.  *        ActivePage (out) - Active display page number                      *
  177.  *  ----------------------------------------------------------------------}  *
  178.  *                                                                           *
  179.  *  Function ActiveDisplayPage: Byte;                                        *
  180.  *  {                                                                        *
  181.  *   DESCRIPTION:                                                            *
  182.  *        Returns the active Video Display Page.  Useful for other           *
  183.  *        routines that demand a Page be passed into them.                   *
  184.  *   SYNTAX:                                                                 *
  185.  *        1.  Writeln(ActiveDisplayPage);                                    *
  186.  *        2.  GetCharXY(12,3, ActiveDisplayPage, Ch, Attr);                  *
  187.  *  ----------------------------------------------------------------------}  *
  188.  *                                                                           *
  189.  *  Procedure SetPage(Page: Byte);                                           *
  190.  *  {                                                                        *
  191.  *   DESCRIPTION:                                                            *
  192.  *        Sets active display page.                                          *
  193.  *   PARAMETERS:                                                             *
  194.  *        Page (in) - Display page to switch to                              *
  195.  *   NOTE(S):                                                                *
  196.  *        Page is [0-3] in 80 column text mode                               *
  197.  *                [4-7] in graphics modes.                                   *
  198.  *        Can be used in conjunction with ClrPage, WriteStrPage,             *
  199.  *        and WriteChPage procedures to produce "instant" pages of text.     *
  200.  *  ----------------------------------------------------------------------}  *
  201.  *                                                                           *
  202.  *  Procedure SetCurPosPage(X,Y, Page: Byte);                                *
  203.  *  {                                                                        *
  204.  *   DESCRIPTION:                                                            *
  205.  *        Sets the cursor position on a give page.  Used primarily by        *
  206.  *        other procedures within this Unit, but can be called               *
  207.  *        separately.                                                        *
  208.  *   PARAMETERS:                                                             *
  209.  *        X, Y (in) - Coordinates on which the cursor should be placed       *
  210.  *        Page (in) - Display page to use                                    *
  211.  *   NOTE(S):                                                                *
  212.  *        Remember that the display page on which you may be positioning     *
  213.  *        the cursor may not be the ACTIVE display page.                     *
  214.  *  ----------------------------------------------------------------------}  *
  215.  *                                                                           *
  216.  *  Procedure GetCharXY(X,Y, Page: Byte; var Ch: Char; var Attr: Byte);      *
  217.  *  {                                                                        *
  218.  *   DESCRIPTION:                                                            *
  219.  *        Scans the CRT for the character and its attribute at a given       *
  220.  *        position on a given display page.                                  *
  221.  *   PARAMETERS:                                                             *
  222.  *        X, Y  (in) - Coordinates of position to be scanned                 *
  223.  *        Page  (in) - Display page to scan                                  *
  224.  *        Ch   (out) - Character found at requested position                 *
  225.  *        Attr (out) - Attribute of the character found                      *
  226.  *   NOTE(S):                                                                *
  227.  *        Since a character does exist at every position on the screen       *
  228.  *        on any page, Ch will return a "blank" character (#32) if no        *
  229.  *        other character was found.                                         *
  230.  *  ----------------------------------------------------------------------}  *
  231.  *                                                                           *
  232.  *  Procedure WriteChPage(X,Y, Page: Byte; Ch: Char; NumReps: Integer;       *
  233.  *                        Attr: Byte);                                       *
  234.  *  {                                                                        *
  235.  *   DESCRIPTION:                                                            *
  236.  *        Writes a character at screen coordinates X, Y (Column, Row         *
  237.  *        respectively) on a given Display Page with a given                 *
  238.  *        Attribute.                                                         *
  239.  *   PARAMETERS:                                                             *
  240.  *        X, Y    (in) - Coordinates at which to write the character         *
  241.  *        Page    (in) - Display page to write to                            *
  242.  *        Ch      (in) - Actual character to write                           *
  243.  *        NumReps (in) - Number of times to write the character              *
  244.  *        Attr    (in) - Attribute to use when writing the character         *
  245.  *   SYNTAX:                                                                 *
  246.  *        1.  WriteChPage(12,3, ActiveDisplayPage, 'G', 1, MakeAttr(15,1));  *
  247.  *        2.  WriteChPage(13,4, 0, 'a', 2, 7);                               *
  248.  *   NOTE(S):                                                                *
  249.  *        Use with other page routines to create instant pages of text.      *
  250.  *  ----------------------------------------------------------------------}  *
  251.  *                                                                           *
  252.  *  Procedure WriteStrPage(X,Y, Page: Byte; aStr: String; Attr: Byte);       *
  253.  *  {                                                                        *
  254.  *   DESCRIPTION:                                                            *
  255.  *        Writes a string at screen coordinates X, Y on a given Display      *
  256.  *        Page with a give Attribute.                                        *
  257.  *   PARAMETERS:                                                             *
  258.  *        X, Y    (in) - Coordinates at which to write the string            *
  259.  *        Page    (in) - Display page to write to                            *
  260.  *        aStr    (in) - Actual string to write                              *
  261.  *        Attr    (in) - Attribute to use when writing the string            *
  262.  *   SYNTAX:                                                                 *
  263.  *        1.  WriteStrPage(1,10, ActiveDisplayPage, 'Turbo', 7);             *
  264.  *        2.  WriteStrPage(2,23, 1, 'Hello', MakeAttr(0,3));                 *
  265.  *   NOTE(S):                                                                *
  266.  *        Use with other page routines to create instant pages of text.      *
  267.  *  ----------------------------------------------------------------------}  *
  268.  *                                                                           *
  269.  *  Procedure ClrPage(Page: Byte);                                           *
  270.  *  {                                                                        *
  271.  *   DESCRIPTION:                                                            *
  272.  *        Clears a given Display Page and sets the cursor to the upper       *
  273.  *        left hand corner of that page.  Similar to ClrScr procedure.       *
  274.  *   PARAMETERS:                                                             *
  275.  *        Page (in) - Display page to clear                                  *
  276.  *   NOTE(S):                                                                *
  277.  *        Should be called before writing to a given display page, since     *
  278.  *        that page may have "garbage" from previous applications.           *
  279.  *  ----------------------------------------------------------------------}  *
  280.  *                                                                           *
  281.  *  Procedure GetKey(var Code: Byte; var Extkey: Boolean);                   *
  282.  *  {                                                                        *
  283.  *   DESCRIPTION:                                                            *
  284.  *        Gets a key from the keyboard--returns it's ASCII value and         *
  285.  *        whether or not it is "extended".                                   *
  286.  *   PARAMETERS:                                                             *
  287.  *        Code   (out) - ASCII value of key pressed (See Turbo Manual)       *
  288.  *        Extkey (out) - TRUE if key is "extended", FALSE otherwise          *
  289.  *   SYNTAX:                                                                 *
  290.  *        GetKey(Code, Extended);                                            *
  291.  *   NOTE(S):                                                                *
  292.  *        Normal keys return a single code with Extkey set to FALSE,         *
  293.  *        extended keys (Alt-A, F10, Alt-F3, etc) return a single            *
  294.  *        code (See Turbo Manual) with Extkey set to TRUE.                   *
  295.  *  ----------------------------------------------------------------------}  *
  296.  *                                                                           *
  297.  *  Function CapsLockON: Boolean;                                            *
  298.  *  {                                                                        *
  299.  *   DESCRIPTION:                                                            *
  300.  *        Returns TRUE if Caps-Lock key is active--FALSE otherwise.          *
  301.  *   SYNTAX:                                                                 *
  302.  *        If CapsLockON Then                                                 *
  303.  *          WriteLn('Caps-Lock key is currently ENABLED');                   *
  304.  *  ----------------------------------------------------------------------}  *
  305.  *                                                                           *
  306.  *  Function NumLockON: Boolean;                                             *
  307.  *  {                                                                        *
  308.  *   DESCRIPTION:                                                            *
  309.  *        Returns TRUE if Num-Lock key is active--FALSE otherwise.           *
  310.  *  ----------------------------------------------------------------------}  *
  311.  *                                                                           *
  312.  *  Function ScrollLockON: Boolean;                                          *
  313.  *  {                                                                        *
  314.  *   DESCRIPTION:                                                            *
  315.  *        Returns TRUE if Scroll-Lock key is active--FALSE otherwise.        *
  316.  *  ----------------------------------------------------------------------}  *
  317.  *                                                                           *
  318.  *  Function RightShift: Boolean;                                            *
  319.  *  {                                                                        *
  320.  *   DESCRIPTION:                                                            *
  321.  *        Returns TRUE if the Right Shift key is depressed at the time of    *
  322.  *        the call to the function--FALSE otherwise.                         *
  323.  *  ----------------------------------------------------------------------}  *
  324.  *                                                                           *
  325.  *  Function LeftShift: Boolean;                                             *
  326.  *  {                                                                        *
  327.  *   DESCRIPTION:                                                            *
  328.  *        Returns TRUE if the Left Shift key is depressed at the time of     *
  329.  *        the call to the function--FALSE otherwise.                         *
  330.  *  ----------------------------------------------------------------------}  *
  331.  *                                                                           *
  332.  *  Function AltPressed: Boolean;                                            *
  333.  *  {                                                                        *
  334.  *   DESCRIPTION:                                                            *
  335.  *        Returns TRUE if the Alt key is depressed at the time of the        *
  336.  *        call to the function--FALSE otherwise.                             *
  337.  *  ----------------------------------------------------------------------}  *
  338.  *                                                                           *
  339.  *  Function CtrlPressed: Boolean;                                           *
  340.  *  {                                                                        *
  341.  *   DESCRIPTION:                                                            *
  342.  *        Returns TRUE if the Ctrl key is depressed at the time of the       *
  343.  *        call to the function--FALSE otherwise.                             *
  344.  *  ----------------------------------------------------------------------}  *
  345.  *                                                                           *
  346.  *  Function InsertModeON: Boolean;                                          *
  347.  *  {                                                                        *
  348.  *   DESCRIPTION:                                                            *
  349.  *        Returns TRUE if the machine global insert mode is active at        *
  350.  *        the time of the call to the function--FALSE otherwise.             *                *
  351.  *  ----------------------------------------------------------------------}  *
  352.  *                                                                           *
  353.  *  Procedure SaveScreen(var aScreen: ScreenType; Height: Byte;              *
  354.  *                       var Status: Byte);                                  *
  355.  *  {                                                                        *
  356.  *   DESCRIPTION:                                                            *
  357.  *        Saves the contents of the TEXT screen to memory.  Each screen      *
  358.  *        needs about 4000 bytes (4k) of memory.  You may have as many       *
  359.  *        screens saved to memory as you wish, however one page              *
  360.  *        (VirtualPage, of type ScreenType) is supplied for you at the       *
  361.  *        VARiable declaration of this UNIT.                                 *
  362.  *   PARAMETERS:                                                             *
  363.  *        aScreen (out) - Screen is saved to this varialbe:  All Chars,      *
  364.  *                        their attributes, and the Height of the Screen.    *
  365.  *        Height   (in) - The height of your screen--usually 25, may differ  *
  366.  *                        according to Display Adaptor (VGA/EGA/etc).        *
  367.  *        Status  (out) - Returns 0 if Screen Save was successful, 1         *
  368.  *                        otherwise (lack of memory).                        *
  369.  *   SYNTAX:                                                                 *
  370.  *        SaveScreen(VirtualScreen, 25, Result);                             *
  371.  *   NOTE(S):                                                                *
  372.  *        See also RestoreScreen procedure.                                  *
  373.  *  ----------------------------------------------------------------------}  *
  374.  *                                                                           *
  375.  *  Procedure RestoreScreen(aScreen: ScreenType);                            *
  376.  *  {                                                                        *
  377.  *   DESCRIPTION:                                                            *
  378.  *        Restores a text screen stored in variable aScreen to Video         *
  379.  *        Display Memory instantly.                                          *
  380.  *   PARAMETERS:                                                             *
  381.  *        aScreen (in) - "Screen" [variable] to restore.  Will be place      *
  382.  *                       directly to Video Display Memory for an             *
  383.  *                       instantaneous text display.                         *
  384.  *   SYNTAX:                                                                 *
  385.  *        RestoreScreen(VirtualScreen);                                      *
  386.  *   NOTE(S):                                                                *
  387.  *        See also SaveScreen procedure.  It is not necessary to pass in     *
  388.  *        the height of the screen again since it is saved when you make     *
  389.  *        a call to SaveScreen.                                              *
  390.  *  ----------------------------------------------------------------------}  *
  391.  *                                                                           *
  392.  *  Function NumSecsMidNight: Real;                                          *
  393.  *  {                                                                        *
  394.  *   DESCRIPTION:                                                            *
  395.  *        Returns the number of seconds elapsed since Midnight.              *
  396.  *   SYNTAX:                                                                 *
  397.  *        1.  Writeln(NumSecsMidNight:0:2);                                  *
  398.  *        2.  r := NumSecsMidNight;                                          *
  399.  *   NOTE(S):                                                                *
  400.  *        Used primarily by CheckTime procedure.                             *
  401.  *  ----------------------------------------------------------------------}  *
  402.  *  Procedure DelaySeconds(NumSecs: Real; KeyIntr: Boolean);                 *
  403.  *  {                                                                        *
  404.  *   DESCRIPTION:                                                            *
  405.  *        Delays a specified number of seconds.                              *
  406.  *   PARAMETERS:                                                             *
  407.  *        NumSecs (in) - Number of seconds to wait.                          *
  408.  *        KeyIntr (in) - Pass in ON or OFF to specify whether or not         *
  409.  *                       to allow a keypress to bypass the full wait.        *
  410.  *   SYNTAX:                                                                 *
  411.  *        DelaySeconds(5.0, ON);                                             *
  412.  *          - Pauses system for about five seconds.  If a key is pressed     *
  413.  *            before time has expired.                                       *
  414.  *   NOTE(S):                                                                *
  415.  *        Useful for programs which may half to run on various levels        *
  416.  *        of PCs, since Turbo's Delay command produces unpredictable         *
  417.  *        affects.  AdvCRT's procedure uses the system clock to delay.       *
  418.  *        DelaySeconds is a close approximation, but the time will not       *
  419.  *        be exactly NumSecs seconds.                                        *
  420.  *  ----------------------------------------------------------------------}  *
  421.  *                                                                           *
  422.  *  Procedure CheckTime(Action: Byte);                                       *
  423.  *  {                                                                        *
  424.  *   DESCRIPTION:                                                            *
  425.  *        Checks the length of time a specific task takes.  Can be used      *
  426.  *        as a programming aid to time procedures, etc.                      *
  427.  *   PARAMETERS:                                                             *
  428.  *        Action       (in) - 0, 1, or 2 are valid parameters.               *
  429.  *                            0 to reset timer                               *
  430.  *                            1 to start timer                               *
  431.  *                            2 to stop timer                                *
  432.  *        ElapsedTime   N/A - Global variable which stores the elapsed       *
  433.  *                            time since the timer was turned on.            *
  434.  *   SYNTAX:                                                                 *
  435.  *        CheckTime(0);                                                      *
  436.  *          - Resets AdvCRT's internal timer.                                *
  437.  *        CheckTime(1);                                                      *
  438.  *          - Turns timer ON.                                                *
  439.  *        CheckTime(2); Writeln(ElapsedTime);                                *
  440.  *          - Turns timer OFF.  Displays the amount of time elapsed since    *
  441.  *            the timer was turned on.                                       *
  442.  *   NOTE(S):                                                                *
  443.  *        AdvCRT's internal "timer" is a real global variable "StoreTime"    *
  444.  *        and may be manipulated if need be.                                 *
  445.  *  ----------------------------------------------------------------------}  *
  446.  *                                                                           *
  447.  *  Procedure CapsLockKey(ONorOFF: Boolean);                                 *
  448.  *  {                                                                        *
  449.  *   DESCRIPTION:                                                            *
  450.  *        Sets the keyboard CAPS-LOCK state to Upper Case or Lower Case.     *
  451.  *   PARAMETERS:                                                             *
  452.  *        ONorOFF (in) - Pass in ON to set keyboard to Upper Case state,     *
  453.  *                       or OFF to set keyboard to Lower Case state          *
  454.  *   SYNTAX:                                                                 *
  455.  *        1.  CapsLockKey(ON);  - Turns CAPS-LOCK state ON                   *
  456.  *        2.  CapsLockKey(OFF); - Turns CAPS-LOCK state OFF                  *
  457.  *   NOTE(S):                                                                *
  458.  *        Sets the CAPS-LOCK state regardless of what the current state      *
  459.  *        happens to be.                                                     *
  460.  *  ----------------------------------------------------------------------}  *
  461.  *                                                                           *
  462.  *  Procedure NumLockKey(ONorOFF: Boolean);                                  *
  463.  *  {                                                                        *
  464.  *   DESCRIPTION:                                                            *
  465.  *        Sets the keypad to its Cursor Control or Numeric state.            *
  466.  *   PARAMETERS:                                                             *
  467.  *        ONorOFF (in) - Pass in ON to set the keypad to its Numeric         *
  468.  *                       state, or OFF keypad to its Cursor Control state    *
  469.  *   SYNTAX:                                                                 *
  470.  *        1.  NumLockKey(ON);  - Turns NUM-LOCK state ON                     *
  471.  *        2.  NumLockKey(OFF); - Turns NUM-LOCK state OFF                    *
  472.  *   NOTE(S):                                                                *
  473.  *        Sets the NUM-LOCK state regardless of what the current state       *
  474.  *        happens to be.                                                     *
  475.  *  ----------------------------------------------------------------------}  *
  476.  *                                                                           *
  477.  *  Procedure PrintScreen(var Status: Byte);                                 *
  478.  *  {                                                                        *
  479.  *   DESCRIPTION:                                                            *
  480.  *        Causes the current text or graphics screen to be printed to        *
  481.  *        printer 0, the default printer.                                    *
  482.  *   PARAMETERS:                                                             *
  483.  *        Status (out) - Status of the Print-Screen procedure                *
  484.  *           00 - OK status                                                  *
  485.  *           01 - A Print-Screen operation is currently in progress          *
  486.  *          255 - An error occured during a Print-Screen                     *
  487.  *   SYNTAX:                                                                 *
  488.  *        PrintScreen(Status);                                               *
  489.  *   NOTE(S):                                                                *
  490.  *        Identical to standard "Shift-PrtSc" key on the keyboard.           *
  491.  *        Note that in order to print graphics screens, it may be            *
  492.  *        necessary to first install the GRAPHICS.COM program found on       *
  493.  *        your DOS distribution diskette.                                    *
  494.  *  ----------------------------------------------------------------------}  *
  495.  *                                                                           *
  496.  *  Procedure PurgeKBDBuffer;                                                *
  497.  *  {                                                                        *
  498.  *   DESCRIPTION:                                                            *
  499.  *        Causes a purge of the type-ahead keyboard buffer.  Any characters  *
  500.  *        which may have existed between the HEAD and TAIL of the keyboard   *
  501.  *        buffer [circular] queue are cleared.                               *
  502.  *   SYNTAX:                                                                 *
  503.  *        ClrScr;                                                            *
  504.  *        PurgeKBDBuffer;                                                    *
  505.  *        Write('Press any key to continue...');                             *
  506.  *        GetKey(Code, ExtendedKey);                                         *
  507.  *   NOTE(S):                                                                *
  508.  *        This procedure uses the global addresses KBDBufferHead and         *
  509.  *        KBDBufferTail which point to the PC's internal type-ahead          *
  510.  *        keyboard buffer.                                                   *
  511.  *  ----------------------------------------------------------------------}  *
  512.  *                                                                           *
  513.  *  Function SizeKBDBuffer: Integer;                                         *
  514.  *  {                                                                        *
  515.  *   DESCRIPTION:                                                            *
  516.  *        Returns the size (in bytes) of the type-ahead keyboard buffer.     *
  517.  *        Default size for PCs is 16 bytes.                                  *             *
  518.  *   SYNTAX:                                                                 *
  519.  *        Writeln('Keyboard buffer size: ', SizeKBDBuffer);                  *
  520.  *   NOTE(S):                                                                *
  521.  *        This function is type Integer (instead of Byte) because of the     *
  522.  *        fact that the size of the buffer may indeed be greater than        *
  523.  *        a Byte's maximum value of 255.                                     *
  524.  *  ----------------------------------------------------------------------}  *
  525.  *                                                                           *
  526.  *****************************************************************************)
  527.